package com.kingsoft.dc.khaos.module.spark.request.model

/**
  *
  * @author gaosong3@kingsoft.com 
  * @date 2019/2/26
  */

//参数实体
case class PageParam(page: Int, pageSize: Int)

case class PhysicalInputParams(val env: String, val projectId: Int, val dsId: Int, val dbName: String, val tblName: String, val privilege: String)

case class TableMetaInputParams(val env: String, val projectId: Int, val dsId: Int, val dbName: String, val tblName: String, val tblType: String, val pageParam: PageParam = null)

case class ColumnMetaInputParams(val env: String, val projectId: Int, val dsId: Int, val dsName: String, val dbName: String, val tblName: String, val tblType: String)

case class DBMetaInputParams(val env: String, val projectId: Int, val dataType: String, val dsId: Int, val dbName: String, val pageParam: PageParam = null)

case class DataManagerRightParams(val projectId: ProjectParam, val metadataPrivsList: List[MetadataPrivsList], val env: String, val dataSourceId: String)

case class MetadataPrivsList(val dbName: String, val tableName: String, val privSet: List[String])

case class ProjectParam(val projectId: String)

//数据源oracle/mpp元数据相关实体
case class TempRdbmsMessage(status: String = "", message: String = "", result: List[DSRdbmsEntity] = Nil)

case class DSRdbmsEntity(dbName: String = "", dbCnName: String = "", dbCode: String = "", dsName: String = "", dsId: Int, dbType: String = "", config: DSRdbmsConfigEntity = null)

case class DSRdbmsConfigEntity(host: String = "", port: String = "", username: String = "", var password: String = "", instanceName: String = "")

//数据源mysql元数据相关实体
case class TempMysqlMessage(status: String = "", message: String = "", result: List[DSMysqlEntity] = Nil)

case class DSMysqlEntity(dbName: String = "", dbCnName: String = "", dbCode: String = "", dsName: String = "", dsId: Int, dbType: String = "", config: DSMysqlConfigEntity = null)

case class DSMysqlConfigEntity(host: String = "", port: String = "", username: String = "", password: String = "")

//数据源cos元数据相关实体
case class TempCosMessage(status: String = "", message: String = "", result: List[DSCosEntity] = Nil)

case class DSCosEntity(dbName: String = "", dbCnName: String = "", dbCode: String = "", dsName: String = "", dsId: Int, dbType: String = "", var config: DSCosConfigEntity = null)

case class DSCosConfigEntity(region: String = "", accessKeyId: String = "", var accessKeySecret: String = "", endpoint: String = "")

//数据源hive元数据相关实体
case class TempHiveMessage(status: String = "", message: String = "", result: List[DSHiveEntity] = Nil)

case class DSHiveEntity(dbName: String = "", dbCnName: String = "", dbCode: String = "", dsName: String = "", dsId: Int, dbType: String = "", config: DSHiveConfigEntity = null)

case class DSHiveConfigEntity(host: String = "", username: String = "", password: String = "", thriftUrls: String = "")


//用户权限相关实体
case class TempDmrpMessage(result: DataManagerRightEntity = null, message: String = "", status: String = "", totalPrivs: Boolean = false)

case class DataManagerRightEntity(columnName: String = "", dbName: String = "", privsResults: DataManagerRightPrivsEntity = null, tableName: String = "")

case class DataManagerRightPrivsEntity(INSERT: Option[Boolean], SELECT: Option[Boolean])


//库表元数据相关实体
case class TempTableMessage(status: String = "", message: String = "", pagination: Any, result: List[TableEntiy] = Nil)

case class TempColumnMessage(status: String = "", message: String = "", pagination: Any, result: List[ColumnEntiy] = Nil)

case class TempDBMessage(status: String = "", message: String = "", pagination: Any, result: List[DBEntiy] = Nil)

case class TableEntiy(tblType: Option[String], tblName: Option[String], chsName: Option[String], tblComment: Option[String], version: Option[String], var params: List[ParamsEntiy] = Nil)

case class ColumnEntiy(colName: Option[String], chsName: Option[String], colType: Option[String], length: Option[String], colComment: Option[String], params: List[ParamsEntiy] = Nil)

//case class ColumnEntiy(colName: String = "", chsName: String = "", colType: String = "", length: String = "", colComment: String = "", params: List[ParamsEntiy] = Nil)

case class DBEntiy(dbName: Option[String], dbChsName: Option[String], dbCode: Option[String], dbComment: Option[String], createUser: Option[String], createTime: Option[String], projectId: Option[String], dsId: Option[String], var params: List[ParamsEntiy] = Nil)

case class ParamsEntiy(pKey: String = "", pValue: String = "")


//数据同步插件json实体
case class JobConfigEntity(syncSourceConfig: SyncSourceEntity = null, syncOperatorConfig: SyncOperatorEntity = null, syncSinkConfig: SyncSinkEntity = null, cosFilePath: String = "", bizDate: String = "", bizTime: String = "", batchNo: String = "", submitTime: String = "", jobInstanceId: String = "", projectId: String = "")

case class SyncEntity(source: SyncSourceEntity = null, operator: SyncOperatorEntity = null, sink: SyncSinkEntity = null)

case class SyncSourceEntity(env: String = "", ds_type: String = "", ds_id: String = "", ds_name: String = "", user_id: String = "", project_id: String = "", properties: SyncPropertiesEntity = null)

case class SyncPropertiesEntity(db_name: String = "", table_name: String = "", filter: String = "")

case class SyncOperatorEntity(source_table: List[SyncOperatorSourceTableEntity] = Nil, target_table: List[SyncOperatorTargetTableEntity] = Nil, relation: List[SyncOperatorRelationEntity] = Nil)

case class SyncOperatorSourceTableEntity(column_name: String = "", tag: String = "", data_type: String = "", expression: String = "")

case class SyncOperatorTargetTableEntity(column_name: String = "", data_type: String = "")

case class SyncOperatorRelationEntity(source_column_name: String = "", target_column_name: String = "")

case class SyncSinkEntity(env: String = "", ds_type: String = "", ds_id: String = "", ds_name: String = "", write_type: String = "", user_id: String = "", project_id: String = "", properties: SyncPropertiesEntity = null)

case class SyncOperatorSourceTableResult(column_name: String = "", tag: String = "", data_type: String = "", expressionResult: String = "")

//租户AK SK 接口信息
case class TempTenantMessage(status: String = "", message: String = "", pagination: Any, result: TenantEntity)

case class TenantEntity(ak: Option[String], sk: Option[String], appId: Option[String])

